// pages/user/recommend/resume/resume.js
const config = getApp().globalData.config
const T = getApp().globalData.T
let token = ''
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    token = getApp().globalData.token;
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getList();
  },
  getList() {
    T.req({
      loadTitle: '加载中...',
      url: config.api + 'recommendation/resume/list',
      method: 'GET',
      data: {
        token: token
      },
      success: (res) => {
        if (res.rowCount == 0) {
          return;
        }
        let list = JSON.parse(JSON.stringify(res.list));
        list.map(ele => {
          ele.recommend = true;
          ele.isReward = false
        })
        this.setData({ list })
      }
    })
  },
  onDetail(e) {
    let id = e.currentTarget.dataset.id;
    let param = {
      id: id,
      origin: 'recommend'
    }
    wx.navigateTo({
      url: '/pages/home/reward/resume/details?' + T.param(param),
    })
  }
})